From: kfraser@localhost.localdomain Date: Mon, 10 Jul 2006 14:01:49 +0000 (+0100) Subject: [HVM] Fix "Many lost ticks" warning in ia32e guest X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15885 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=cf021d7e7d9aac9e65a1abb046323c17b4c718dd;p=xen.git [HVM] Fix "Many lost ticks" warning in ia32e guest Signed-off-by: Eddie Dong Signed-off-by: Xiaowei Yang --- diff --git a/xen/arch/x86/hvm/i8254.c b/xen/arch/x86/hvm/i8254.c index d457815667..de2d5d3b94 100644 --- a/xen/arch/x86/hvm/i8254.c +++ b/xen/arch/x86/hvm/i8254.c @@ -188,6 +188,12 @@ int pit_get_gate(PITState *pit, int channel) return s->gate; } +void pit_time_fired(struct vcpu *v, void *priv) +{ + PITChannelState *s = priv; + s->count_load_time = hvm_get_clock(v); +} + static inline void pit_load_count(PITChannelState *s, int val) { u32 period; @@ -209,11 +215,11 @@ static inline void pit_load_count(PITChannelState *s, int val) switch (s->mode) { case 2: /* create periodic time */ - s->pt = create_periodic_time (s->vcpu, period, 0, 0); + s->pt = create_periodic_time (s, period, 0, 0); break; case 1: /* create one shot time */ - s->pt = create_periodic_time (s->vcpu, period, 0, 1); + s->pt = create_periodic_time (s, period, 0, 1); #ifdef DEBUG_PIT printk("HVM_PIT: create one shot time.\n"); #endif diff --git a/xen/arch/x86/hvm/intercept.c b/xen/arch/x86/hvm/intercept.c index 25a715cdfd..5c8e57c555 100644 --- a/xen/arch/x86/hvm/intercept.c +++ b/xen/arch/x86/hvm/intercept.c @@ -261,11 +261,12 @@ void pickup_deactive_ticks(struct periodic_time *pt) * period: fire frequency in ns. */ struct periodic_time * create_periodic_time( - struct vcpu *v, + PITChannelState *s, u32 period, char irq, char one_shot) { + struct vcpu *v = s->vcpu; struct periodic_time *pt = &(v->domain->arch.hvm_domain.pl_time.periodic_tm); if ( pt->enabled ) { if ( v->vcpu_id != 0 ) { @@ -290,6 +291,7 @@ struct periodic_time * create_periodic_time( pt->scheduled = NOW() + period; set_timer (&pt->timer,pt->scheduled); pt->enabled = 1; + pt->priv = s; return pt; } diff --git a/xen/arch/x86/hvm/vmx/io.c b/xen/arch/x86/hvm/vmx/io.c index 13d3d66212..726782eb45 100644 --- a/xen/arch/x86/hvm/vmx/io.c +++ b/xen/arch/x86/hvm/vmx/io.c @@ -75,6 +75,7 @@ interrupt_post_injection(struct vcpu * v, int vector, int type) pt->pending_intr_nr--; pt->last_plt_gtime += pt->period_cycles; set_guest_time(v, pt->last_plt_gtime); + pit_time_fired(v, pt->priv); } } diff --git a/xen/include/asm-x86/hvm/vpit.h b/xen/include/asm-x86/hvm/vpit.h index e0d7698eb5..eb3ccd1207 100644 --- a/xen/include/asm-x86/hvm/vpit.h +++ b/xen/include/asm-x86/hvm/vpit.h @@ -64,6 +64,7 @@ struct periodic_time { s_time_t scheduled; /* scheduled timer interrupt */ u64 last_plt_gtime; /* platform time when last IRQ is injected */ struct timer timer; /* ac_timer */ + void *priv; /* ponit back to platform time source */ }; typedef struct PITState { @@ -93,9 +94,10 @@ static __inline__ s_time_t get_scheduled( extern void hvm_hooks_assist(struct vcpu *v); extern void pickup_deactive_ticks(struct periodic_time *vpit); extern u64 hvm_get_guest_time(struct vcpu *v); -extern struct periodic_time *create_periodic_time(struct vcpu *v, u32 period, char irq, char one_shot); +extern struct periodic_time *create_periodic_time(PITChannelState *v, u32 period, char irq, char one_shot); extern void destroy_periodic_time(struct periodic_time *pt); void pit_init(struct vcpu *v, unsigned long cpu_khz); void pt_timer_fn(void *data); +void pit_time_fired(struct vcpu *v, void *priv); #endif /* __ASM_X86_HVM_VPIT_H__ */